import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';

import 'deviceinfo_platform_interface.dart';

/// An implementation of [DeviceinfoPlatform] that uses method channels.
class MethodChannelDeviceinfo extends DeviceinfoPlatform {
  /// The method channel used to interact with the native platform.
  @visibleForTesting
  final methodChannel = const MethodChannel('deviceinfo');

  @override
  void initDeviceInfo() {
    methodChannel.invokeMethod<Map>('initDeviceInfo');
  }

  @override
  Future<Map?> getDeviceInfo() async {
    final version = await methodChannel.invokeMethod<Map>('getDeviceInfo');
    return version;
  }

  @override
  Future<Map?> appRank() async {
    final version = await methodChannel.invokeMethod<Map>('appRank');
    return version;
  }
}
